<template>
  <div>
    <el-col>
      <p style="font-size: 30px">科举试题</p>
      <el-input v-model="str" @blur="search" placeholder="请输入题目"></el-input>
    </el-col>

    <el-col>
      <el-col v-show="tLen" style="text-align: center;color: #e2e2e2">无内容</el-col>
      <el-card v-for="t in topicList" :key="t.id" style="margin-top: 15px">
        <p>{{ t.question }}</p>
        <p>答案: {{ t.answer }}</p>
      </el-card>
    </el-col>
  </div>
</template>

<script>
import {j3api} from "@/axios/j3http";

export default {
  name: "TopicPage",
  data() {
    return {
      str: '',
      topicList: [],
      tLen: false
    }
  },
  methods: {
    search() {
      j3api.getTopic(this.str).then(res => {
        console.log(res);
        this.topicList = res.data
        if (res.code === 400){
          this.tLen = true
        }else {
          this.tLen = false
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
